package com.mccken.designpattern.chain.base.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mccken.designpattern.chain.base.McckenChainHandler;
import com.mccken.designpattern.chain.base.demo.handler.AuthHandler;
import com.mccken.designpattern.chain.base.demo.handler.LoginHandler;
import com.mccken.designpattern.chain.base.demo.handler.RegisterHandler;
import com.mccken.designpattern.chain.base.demo.handler.ValidateHandler;

/**
 * @program: mccken-collect
 * @description:
 * @author: mccken
 * @create: 2024-02-16 14:21
 **/
@Service
public class LoginChainFactory {

	@Autowired
	private ValidateHandler validateHandler;
	
	@Autowired
	private AuthHandler authHandler;
	
	@Autowired
	private RegisterHandler registerHandler;
	
	@Autowired
	private LoginHandler loginHandler;

	public McckenChainHandler buildLoginHandleChain() {
		return McckenChainHandler.builder()
				.addHandler(validateHandler)
				.addHandler(authHandler)
				.addHandler(registerHandler)
				.addHandler(loginHandler)
				.build();
	}
	
	
}
